package cn.tedu.spring.life;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Life {
    private String meaning;

    public Life() {
        System.out.println("1.实例化,调用无参构造");
    }
    @Value("去码头吃点薯条")
    public void setMeaning(String meaning) {
        this.meaning = meaning;
        System.out.println("2.属性赋值,调用set方法");
    }
    @PostConstruct
    public void init(){
        System.out.println("3.初始化,[执行init方法]");
    }
    @PreDestroy
    public void destroy() {
        System.out.println("5.销毁[执行destroy方法]");
    }
}
